package org.eclipse.moquette.spi.impl.security;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.text.ParseException;
import java.util.Collections;
import java.util.List;

/**
 * Created by xuwei on 2015/6/6.
 */
public class ACLAuthorizator implements IAuthorizator {

    private static final Logger LOG = LoggerFactory.getLogger(ACLAuthorizator.class);

    List<Authorization> authorizations = Collections.emptyList();

    public ACLAuthorizator(String aclFilePath) {
        File aclFile = new File(aclFilePath);
        try {
            authorizations = ACLFileParser.parse(aclFile);
        } catch (ParseException pex) {
            LOG.warn(String.format("Format error in parsing acl file %s", aclFile), pex);
        }
    }

    @Override
    public boolean canWrite(String topic) {
        return false;
    }
}
